package top.dark.design.patterns.singleton;

/**
 * Author: Darkn
 * description: 懒汉式，同步代码块，double-check + volatile。即保证了懒加载，高效率，防止重排序保证数据实例化顺序
 * Create Time: 2021/4/25 16:37
 */
public class Singleton06 {
    private static volatile Singleton06 singleton = null;
    public static Singleton06 getInstance() {
        if (singleton == null) {
            synchronized (Singleton06.class) {
                if (singleton == null) {
                    singleton = new Singleton06();
                }
            }
        }
        return singleton;
    }
}
